 <?php
 /* 
 * Useing ADOB to connect to a mysql database named BDAP 
 * I am going to show you 3 exmaples of using adodb's html
 * templeting also.
 */
 //Start the SESSION vars
if (session_id()== "")
{
	session_start();
}
 include_once('/var/www/gde-1.0/htdocs/config.php');
 /* Include adodb */
 include_once("../includes/adodb/adodb.inc.php"); 
 /* includes the rs2html function */
// include('../includes/adodb/tohtml.inc.php');
 /* includes for paging html */
 include_once('../includes/adodb/adodb-pager.inc.php');
 /* Include the database.php to instantiate the db connection */
 include_once(Config::base_path.Config::database_path.'database.php');
 include_once(Config::base_path.Config::database_path."user.php");
include_once(Config::base_path.Config::database_path."html.php");
  include_once(Config::base_path.Config::top_php); 
  include_once(Config::base_path.Config::nav_php); 
  // Include builder functions
 include_once(Config::base_path.Config::builder_func_path."builder.func.php");
 /* Copy in the global db connection from database.php */
 /* Can unset($db) if you want to reuse the connetion */
 $db=db_connect(Config::db_type,Config::db_host,Config::db_username,Config::db_password,'sakila',0);
 $sql = 'select * from BDAP.forum_users ';
 $result = $db->MetaForeignKeys('customer');
 print_r($result);

 foreach ($result as $table)
 {
   if(is_array($table))
   {
      foreach ($table as $field)
      {
        echo "<br>";
        echo $field;
      }
   }
   else
   {
     echo "<br>";
     echo $table;
   }
 }
 
 echo "---------------";
  get_database_pk();
 get_database_fk();
// Array ( [address] => Array ( [0] => address_id=address_id ) 
//           [store] => Array ( [0] => store_id=store_id ))
//$result = $db->Execute($sql);
//query2Html($result);
//record2PagingHtml($db,$sql,2);
///////////$x= new User();

//////////$u=$x->Authenticate("dimatosd","dimatosd",$db);
//echo $u->result;
//echo $u->result;
//echo $u;
/////////if($u == true)
	   
//rs2html($u);
 /*Make the DB connections */
 //$db = NewADOConnection('mysql');
 //$db->Connect(Config::db_host, Config::db_username, "dimatosd", "BDAP");

/*Example output to html */
//$result = $db->Execute("select * from forum_users");
//if ($result === false) die("failed");  
//while (!$result->EOF) 
//{
//	for ($i=0, $max=$result->FieldCount(); $i < $max; $i++)
//		   print $result->fields[$i].' ';
//	$result->MoveNext();
//	print "<br>\n";
//}


 /* rs2html exmaple displing html*/
 //$result = $db->Execute("select * from forum_users");
// rs2html($result); /* recordset to html table */ 

/* Record set pager method with html */
//$sql = 'select * from forum_users where username="'.Config::db_username.'"';
//$pager = new ADODB_Pager($db,$sql);
//include('/home/dimatosd/thesis/html/gde/top.php'); 
//include('/home/dimatosd/thesis/html/gde/nav.php'); 
//$pager->Render($rows_per_page=1);
//echo "<br>";
//unset($db);
//$d=null;
//$d =$dbconn;
//$sql = "select user_id from forum_users ";
//$pager = new ADODB_Pager($d,$sql);
//$pager->Render($rows_per_page=1);
//
?>

